package org.nf.mvc.servlet;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Parameter;

/**
 * @Author : LLH
 * @create 2021/5/26
 *
 * 抽象的参数类型转换器，由不同的子类转换器来实现具体的转换逻辑
 */
public abstract class ParamTypeHandler {

    protected HttpServletRequest request ;
    protected HttpServletResponse response ;

    public void setRequest(HttpServletRequest request) {
        this.request = request;
    }

    public void setResponse(HttpServletResponse response) {
        this.response = response;
    }

    /**
     * 抽象的参数转换，由子类实现
     * @param parameter  当前请求方法中某个参数的信息
     * @return
     */
    protected abstract Object handle(Parameter parameter);


}
